const express=require('express');
const multer=require('multer');
const app=express();
const upload=multer({
    storage:multer.diskStorage({
        destination(req,file,callback){
            callback(null,'./uploadls');
        },
      filename(req,file,callback){
          callback(null,Date.now()+'_'+file.originalname);
      },  
    }),
});
app.post('/avatar',upload.single('avatar'),(req,res,next)=>{
    console.log(req.file);
    res.end('文件上传成功');
});
app.post('/photos',upload.array('photos'),(req,res,next)=>{
    console.log(req.files);
    res.end('上传多张照片成功');
});
app.listen(9000,()=>{
    console.log('express服务器启动成功~');
});